Skip to main content

Unity 获取设备的唯一码

Unity 获取设备的唯一码

SystemInfo.deviceUniqueIdentifier 唯一的设备标识符。保证每个设备都是唯一的(只读)。

Debug.Log(SystemInfo.deviceUniqueIdentifier);

SystemInfo .deviceUniqueIdentifier 留下反馈 公共静态字符串deviceUniqueIdentifier ; 描述 唯一的设备标识符。保证每个设备都是唯一的(只读)。

iOS:在iOS7之前的设备上,它将返回MAC地址的哈希值。在iOS7设备上,它将是UIDevice identifierForVendor,或者,如果由于某种原因失败,则为ASIdentifierManager advertisingIdentifier。

Android: SystemInfo.deviceUniqueIdentifier始终返回ANDROID_ID的md5。(请参阅https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)。请注意,自Android 8.0(API级别26)起,ANDROID_ID取决于应用程序的签名密钥。这意味着“未签名”构建(默认情况下使用调试密钥库进行签名)的值将不同于已签名构建(使用播放器设置中提供的密钥进行签名)。同样在允许Google Play签署您的应用程序时,测试使用上载密钥签名的本地构建应用程序和使用“最终”密钥签名的从Google Play下载的应用程序时,此值将有所不同。

Windows Store Apps:如果“ PC设置->隐私->让应用程序使用我的广告ID进行跨应用程序的体验(关闭此功能将重置您的ID)”中的选项被禁用,则使用AdvertisingManager :: AdvertisingId返回唯一的设备标识符,Unity被禁用将回退到HardwareIdentification :: GetPackageSpecificToken()。Id。

Windows Standalone:从计算机系统硬件类(https://msdn.microsoft.com/zh-cn/library/windows/desktop/aa389273(v=vs.85).aspx)中提取的字符串串联返回哈希值: Win32_BaseBoard :: SerialNumber Win32_BIOS :: SerialNumber Win32_Processor :: UniqueId Win32_DiskDrive :: SerialNumber Win32_OperatingSystem :: SerialNumber在不支持此属性的平台上将